<template>
  <div class="error-store">
    <Tooltip content="错误日志" placement="bottom">
      <Badge dot :count="countComputed">
        <Button type="text" @click="openErrorLoggerPage">
          <Icon :size="20" type="ios-bug"/>
        </Button>
      </Badge>
    </Tooltip>
  </div>
</template>

<script>
export default {
  name: 'ErrorStore',
  props: {
    count: {
      type: Number,
      default: 0
    },
    hasRead: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    countComputed () {
      return this.hasRead ? 0 : this.count
    }
  },
  methods: {
    openErrorLoggerPage () {
      this.$router.push({
        path: '/error-logger/error-logger-page'
      })
    }
  }
}
</script>

<style lang="stylus" scoped>
.error-store
  margin-right 12px
  & >>> .ivu-badge-dot
    top 20px
  & >>> .ivu-btn.ivu-btn-text
    padding 5px 1px 6px
</style>
